<?php

namespace DeCMF\Core\UI\ListView;

/**
 * 文档模型的单元格特性
 */
class DocGrid extends Grid
{
    /**
     *
     * @inheritdoc
     */
    protected $builtinLinks = [
        '[DELETE]' => 'setstatus?status=-1&ids=[id]', 
        '[EDIT]' => 'edit?id=[id]&model=[model_id]&cate_id=[category_id]', 
        '[LIST]' => 'index?pid=[id]&model=[model_id]&cate_id=[category_id]'
    ];
        
    /**
     * 
     * @inheritdoc
     */
    public function __construct(array $def, array $ref)
    {
        if ('title' == $def['field'][0] && '目录' == $ref['type']) {
            // 目录类型自动设置子文档列表链接
            $def['href'] = '[LIST]';
        }
        
        parent::__construct($def, $ref);
    }
    
}